Kickoff users automaticly

Hello,
I want to know if it is possible, to unlock the users, which have open a module of a specific folder.
The problem is, we have a script and this script should run every sunday night, but when the script runs, some users from singapor are already working and the script interrupts. Because of this I want that the script kicks off the users automaticly, like I can do it with TOOLS -> Manage Locks -> Unlock

Can anyone give me a script that works? I´ve tried alot but nothing works...
Reudaeaeae - Tue Sep 21 07:43:38 EDT 2010

Re: Kickoff users automaticly
Mathias Mamsch - Tue Sep 21 09:40:37 EDT 2010

I think you need to do something like:
 

LockList llist = null
 
listOfLocks = getLocksInDatabase(true)
// or 
// Folder f = folder "/my/folder/somewhere"
// listOfLocks = getLocksInFolder(f,true,true) 
 
Lock L 
 
for L in llist do {
    int    mode  = theLock.lockMode
    string user  = theLock.user
    string host  = theLock.host
    Date   ldate = theLock.date
    string annotation  = theLock.annotation
    string itemName  = theLock.resourceName
    Item   theItem = theLock.item
 
    print "Bye " user "!" 
    remove L 
}

 


or something like this. BUT: I advice you not do stuff like this. It not only pisses off users to remove their locks. The question remains: If people have this module opened without any reason (which is imho the only valid reason to remove the locks) why do they have the module opened in edit mode? Why don't you just remove the modify rights from the modules, so that only valid users can lock them? And if the people are working at the modules, you should not kick them, because they will loose their work. Additionally removing locks always bears the risk of corrupting your modules. So I would be very careful with a script like this.

Just my 2cents. Regards, Mathias

 

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS